<?php $url = new Url();?>
<link rel="stylesheet" type="text/css" href="<?=Yii::app()->params["urlRs"] ?>/js/colorbox/colorbox.css" media="all" /> 
<script  src="<?=Yii::app()->params["urlRs"] ?>/js/colorbox/jquery.colorbox.js" type="text/javascript"></script> 

<div id="main" class="nosidebar">                
    <div id="content">

        <h2>Danh mục công việc</h2>

        <div class="flash notice" id="flash_notice" style="display: none;">Sửa dự án thành công!</div>

        <div id="errorExplanation" style="display: none;">
            <ul id="err_msg">
                <!--<li>Tên không thể để trắng</li>
                <li>Mã nhận dạng không thể để trắng</li>
                <li>Mã nhận dạng quá ngắn (tối thiểu 1 ký tự)</li>-->
            </ul>
        </div>

        <?php $this->widget("TabSetting");?>

        <div id="tab-content-versions" class="tab-content">
            <table class="list versions">
                <thead>
                    <tr>
                        <th>Danh mục công việc</th>                        
                        <th>Mô tả</th>                        
                        <th style="width:25%"></th>
                    </tr>
                </thead>
                <tbody>
                    <?php for($i=0;$i<count($data);$i++){?>
                        <tr class="version <?php if(($i%2) == 1){echo "even";}else{echo "odd";} ?> open" id="category_row_<?php echo $data[$i]['category_id']; ?>">
                            <td class="name"><a href="javascript:" id="category_name_<?php echo $data[$i]['category_id']; ?>"><?php echo $data[$i]['category_name']; ?></a></td>                            
                            <td class="description" id="category_des_<?php echo $data[$i]['category_id']; ?>"><?php echo $data[$i]['category_description'];?></td>                            
                            <td class="buttons">
                                <a class="icon icon-edit" href="#popup_version_edit" id="open_pop_2" onclick="edit_mode(<?php echo $data[$i]['category_id']; ?>)">Sửa</a>
                                <a rel="nofollow" data-method="delete" class="icon icon-del" href="javascript:" onclick="delete_category(<?php echo $data[$i]['category_id'];?>)">Xóa</a>
                            </td>
                        </tr>
                        <?php } ?>                
                </tbody>
            </table>            
            <p><a class="icon icon-add" href="#popup_version" id="open_pop">Danh mục công việc mới</a></p>
        </div>         

        <div style="clear:both;"></div>

        <div style="display: none;">
            <div id="popup_version" style="margin: 8px;">
                <h2>Danh mục công việc mới</h2>
                <div class="box tabular">
                    <p><label for="version_name">Tên<span class="required"> *</span></label><input type="text" value="" name="version[name]" id="category_name" style="width: 200px;"></p>
                    <p><label for="version_description">Mô tả</label><input type="text" value="" name="version[description]" id="category_description" style="width: 300px;"></p>                    
                </div>
                <input type="button" value="Tạo" name="commit" onclick="update_category()">
            </div>                     
        </div>
        
        <div style="display: none;">
            <div id="popup_version_edit" style="margin: 8px;">
                <h2>Sửa Danh mục công việc</h2>
                <div class="box tabular">
                    <input type="hidden" id="edit_id" value="0">
                    <p><label for="version_name">Tên<span class="required"> *</span></label><input type="text" value="" name="version[name]" id="category_name_edit" style="width: 200px;"></p>
                    <p><label for="version_description">Mô tả</label><input type="text" value="" name="version[description]" id="category_description_edit" style="width: 300px;"></p>                    
                </div>
                <input type="button" value="Sửa" name="commit" onclick="update_category()">
            </div>                     
        </div>

    </div>
</div>


<?php include "category.js.php"; ?>